
module.exports = app => {

    return class HomeController extends app.Controller {
        async index() {
            await this.ctx.render('forum/answer/index.js');
        }

        async detail() {
            let id = this.ctx.params.id;
            this.app.logger.info(id);
            let post = await this.service.post.detail({ id });

            await this.ctx.render('forum/answer/detail/index.js', {
                post
            });
        }


        async list() {
            let pageNo = this.ctx.request.pageNo;
            let data = await this.ctx.service.post.list({ typeName: 2, pageNo });
            this.success(data)
        }

        async answerList() {
            let pageNo = this.ctx.request.pageNo;
            let data = await this.ctx.service.post.list({ typeName: 2, pageNo });
            this.success(data)
        }


    };
};
